package com.ssy.lingxi.transaction.repository;

import com.ssy.lingxi.transaction.entity.Inquiry;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
*交易中心-商品询价-新增询价单
* @author wrc
* @date 2020/7/8
*/
@Repository
public interface InquiryRepository extends JpaRepository<Inquiry, Long>, JpaSpecificationExecutor<Inquiry> {

    /**
    * 查询审核通过的询价单号
    * @author wrc
    * @date 2020/10/20
    */
    Page<Inquiry> findAllByMemberIdAndInteriorStateAndQuotationAsTimeGreaterThan(Long memberId, Integer interiorState, Long quotationAsTime, Pageable page);

    List<Inquiry> findAllByCreateMemberIdAndCreateRoleId(Long memberId, Long memberRoleId);

    /**
     * 商城能力--企业商城-商品询价动态
     */
    Page<Inquiry> findByShopIdAndInteriorState(Long shopId, Integer interiorState, Pageable page);

    /**
     * 商城能力--企业商城-商品询价动态
     */
    Page<Inquiry> findByUserId(Long userId, Pageable page);

    /**
     * 根据询价单号查询询价单
     * @param inquiryNo
     * @return
     */
    Inquiry findByInquiryListNo(String inquiryNo);
}
